package co2.bean;

import java.io.Serializable;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import co2.engine.DAOInterface;
import co2.engine.SessionValidation;
import co2.pojos.Kelompok;
import co2.pojos.MstUser;
import co2.pojos.SoalLks;

@ManagedBean
@ViewScoped
public class HasilDiskusiLksBean  extends AbstractBean implements Serializable {
	private static final long serialVersionUID = 1L;

	@Autowired
	@Qualifier("daoI")
	private DAOInterface dao;
	
	private MstUser user;
	private Kelompok kelompok;
	private List<MstUser> listAnggota;
	
	private SoalLks soal;
	
	
	@PostConstruct
	public void postCon(){
		SignInBean signInBean = SessionValidation.checkSession();
		
		if(signInBean!=null){
			user = signInBean.getTheUser();
			kelompok = dao.getKelompokForUser(user.getUserId());
			if(kelompok!=null&&kelompok.getId()!=null){
				listAnggota = dao.getDaftarAnggotaKelompok(kelompok.getId());
				soal = dao.getSoalLksByKelompokId(kelompok.getId());
			}
		}
		
	}


	public DAOInterface getDao() {
		return dao;
	}


	public void setDao(DAOInterface dao) {
		this.dao = dao;
	}


	public MstUser getUser() {
		return user;
	}


	public void setUser(MstUser user) {
		this.user = user;
	}


	public Kelompok getKelompok() {
		return kelompok;
	}


	public void setKelompok(Kelompok kelompok) {
		this.kelompok = kelompok;
	}


	public List<MstUser> getListAnggota() {
		return listAnggota;
	}


	public void setListAnggota(List<MstUser> listAnggota) {
		this.listAnggota = listAnggota;
	}


	public SoalLks getSoal() {
		return soal;
	}


	public void setSoal(SoalLks soal) {
		this.soal = soal;
	}

}
